package cn.openea.perpartner.componet.util;

/**
 * @codeDesc: 消息发送时不同的消息类型对应的接口地址处理类
 * @author: Mr.Yun
 * @QQ: 2034374624
 * @version: V1.0
 * @Created: 2021/04/29 22:08
 */
public class MsgTypeHandler {

    private String msgType;

    public MsgTypeHandler(String msgType) {
        this.msgType = msgType;
    }

    public String getMsgApi() {
        // 根据消息类型，在这里适配不同的接口地址
        String apiurl = "";
        if("text".equalsIgnoreCase(msgType)){
            // 文本消息的发送-通过客服接口，https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
            apiurl = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN";
        }
        else if("template".equalsIgnoreCase(msgType)){
            // 发送模板消息-通过模板接口，https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html
            apiurl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";
        }
        return apiurl;
    }
}
